import 'package:boss/ui/page/commodity/bindingCommodity/binding_commodity_page.dart';
import 'package:boss/ui/page/commodity/categories/categories_page.dart';
import 'package:boss/ui/page/commodity/classificationManagement/classification_management_page.dart';
import 'package:boss/ui/page/commodity/material/material_page.dart';
import 'package:boss/ui/page/takeoutManagement/model/takeout_management_card_data.dart';
import 'package:boss/ui/page/takeoutManagement/page/businessSetting/business_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/deliveryFeeSetting/delivery_fee_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/packagingFeeSetting/packaging_fee_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/takeoutList/takeout_list_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/takeoutProcess/takeout_process_page.dart';
import 'package:flutter/material.dart';

import 'takeout_management_card.dart';

class TakeoutManagementContent extends StatelessWidget {
  final List<TakeoutManagementCardData> cards = [
    TakeoutManagementCardData(
      title: '营业设置',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: BusinessSettingPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '配送费设置',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: DeliveryFeeSettingPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '包装费设置',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: PackagingFeeSettingPage.pageName,
    ),
//    TakeoutManagementCardData(
//      title: '满减设置',
//      icon: 'assets/image/bottom_navigation_account_on_icon.png',
//      url: FullReductionSettingPage.pageName,
//    ),
//    TakeoutManagementCardData(
//      title: '优惠券设置',
//      icon: 'assets/image/bottom_navigation_account_on_icon.png',
//      url: CouponSettingPage.pageName,
//    ),
    TakeoutManagementCardData(
      title: '外卖明细',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: TakeoutListPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '接单外卖',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: TakeoutProcessPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '分类管理',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: ClassificationManagementPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '商品管理',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: CategoriesPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '加料管理',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: MaterialManagerPage.pageName,
    ),
    TakeoutManagementCardData(
      title: '关联菜品',
      icon: 'assets/image/bottom_navigation_account_on_icon.png',
      url: BindingCommodityPage.pageName,
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return GridView.builder(
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 4,
      ),
      itemBuilder: (context, index) {
        var current = cards[index];

        return TakeoutManagementCard(
          data: current,
          onTap: () {
            if (current.url == ClassificationManagementPage.pageName ||
                current.url == CategoriesPage.pageName ||
                current.url == MaterialManagerPage.pageName) {
              Navigator.pushNamed(context, current.url);
            } else {
              Navigator.pushNamed(context, current.url);
            }
          },
        );
      },
      itemCount: cards.length,
    );
  }
}
